<?php
require_once '../configs/common.tools.php';

exit('防止误调用 ，结束');
$db = new Data();
$now=time();

$tendaysago = $now-864000;
$lng_data = new Lng();
Common::broadcastMsg($lng_data['maintenance_start']);

//10天前战报,每天产生约15000条
$db->query("delete from war_result where w_time<".$tendaysago." order by w_id asc limit 30000");
//10天前mail,每天产生约3000条
$db->query("delete from mail where e_times<".$tendaysago." and e_read=1 order by id asc limit 10000");
//10天前完成的循环任务,每天产生约10000条
$db->query("delete from system_task where date<".$tendaysago." and p_in=2 and recursive=1 order by id asc limit 20000");

/*table optimize
$db->query("optimize table war_result");
$db->query("optimize table mail");
$db->query("optimize table system_task");
*/
$cmd = system("sudo bash game_mentainace.sh");
Common::broadcastMsg($lng_data['maintenance_end']); // TODO

echo "done";
?>